<script setup lang="ts">
  import {ref,toRefs} from 'vue'
  //导入Home的组件
  import Home from './components/Home.vue'

  let sub = ref()

  let names= ref()
  let ages = ref()

  function showSub(){
    console.log(sub)//RefImpl
    console.log(sub.value)//ProxyImpl

    let {name,age} = toRefs(sub.value)
    console.log(name.value,age.value)
    
    names.value = name.value
    ages.value = age.value

    console.log(names.value,ages.value)
  }
</script>

<template>
    <Home ref="sub"/>
     子组件数据:name:{{names}}, age:{{ages}}
    <button @click="showSub">获取子组件信息</button>
</template>

<style scoped>
  
</style>